import request from '@/utils/request'

// 创建设备/工装巡检计划
export function createMaintenancePlan(data) {
  return request({
    url: '/devices/maintenance-plan/create',
    method: 'post',
    data: data
  })
}

// 更新设备/工装巡检计划
export function updateMaintenancePlan(data) {
  return request({
    url: '/devices/maintenance-plan/update',
    method: 'put',
    data: data
  })
}

// 删除设备/工装巡检计划
export function deleteMaintenancePlan(id) {
  return request({
    url: '/devices/maintenance-plan/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除设备/工装巡检计划 */
export function deleteMaintenancePlanList(ids) {
  return request({
    url: `/devices/maintenance-plan/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得设备/工装巡检计划
export function getMaintenancePlan(id) {
  return request({
    url: '/devices/maintenance-plan/get?id=' + id,
    method: 'get'
  })
}

// 获得设备/工装巡检计划分页
export function getMaintenancePlanPage(params) {
  return request({
    url: '/devices/maintenance-plan/page',
    method: 'get',
    params
  })
}
// 导出设备/工装巡检计划 Excel
export function exportMaintenancePlanExcel(params) {
  return request({
    url: '/devices/maintenance-plan/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}